package com.example.demo.factorypattern;

/**
 * @author :xie
 * Email: 1487471733@qq.com
 * Date: 2018/9/6
 * Time: 18:20
 * Describe:
 */
public class Factory {

    public Car getCar(String color){

        if (color==null){

            return  null;
        }
        if (color.equals("red")){

            return new RedCar();
        }
        if (color.equals("blue")){

            return new BlueCar();
        }

        return null;
    }
}
